package com.dcivision.dms.core;

import java.sql.Connection;

import javax.servlet.http.HttpServletRequest;

import com.dcivision.framework.GlobalConstant;
import com.dcivision.framework.SessionContainer;

/**
 * A factory to produce DocumentValidatetManager instance.
 * 
 * @author henry.chan
 * 
 */
public class DocumentValidationFactory {

  /**
   * Create new instance of DocumentValidateManager with db connection associated with request context and http session
   * context.
   * 
   * @param req HTTP request context
   * @param sess Decorated HTTP session context
   * @return Instance of DocumentValidateManager
   */
  public static DocumentValidateManager createManager(HttpServletRequest req, SessionContainer sess) {
    Connection conn = (Connection) req.getAttribute(GlobalConstant.DB_KEY);
    return new DocumentValidateManager(sess, conn);
  }

}
